/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.groupjjk.spectatorsportsonline.models.NBA;

import com.groupjjk.spectatorsportsonline.fathers.Game;
import com.groupjjk.spectatorsportsonline.fathers.Team;
import com.groupjjk.spectatorsportsonline.models.MLB.MLBTeam;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author Jrdevelopment
 */
@Entity
public class NBAGame extends Game implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @OneToMany(mappedBy = "NbaGame")
    private List<Quarter> quarters = new ArrayList();
    @OneToOne
    private NBATeam teamHome;
    @OneToOne
    private NBATeam teamVisitor;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getId() != null ? getId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NBAGame)) {
            return false;
        }
        NBAGame other = (NBAGame) object;
        if ((this.getId() == null && other.getId() != null) || (this.getId() != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.groupjjk.spectatorsportsonline.models.NBA.NBAGame[ id=" + getId() + " ]";
    }

    /**
     * @return the quarters
     */
    public List<Quarter> getQuarters() {
        return quarters;
    }

    /**
     * @param quarters the quarters to set
     */
    public void setQuarters(Quarter quarter) {
        quarters.add(quarter);
    }

    /**
     * @return the teamHome
     */
    public NBATeam getTeamHome() {
        return teamHome;
    }

    /**
     * @param teamHome the teamHome to set
     */
    public void setTeamHome(NBATeam teamHome) {
        this.teamHome = teamHome;
    }

    /**
     * @return the teamVisitor
     */
    public NBATeam getTeamVisitor() {
        return teamVisitor;
    }

    /**
     * @param teamVisitor the teamVisitor to set
     */
    public void setTeamVisitor(NBATeam teamVisitor) {
        this.teamVisitor = teamVisitor;
    }
}
